import Router from "koa-router";
import { getControllers,regControllers } from "../ulits/tools.js";
import bodyParser from "koa-bodyparser";
import cors from "@koa/cors"

let router = new Router()

export const useControllers = function(app){
    app.use(cors())
    app.use(bodyParser())

    let conterllersFile = getControllers()
    regControllers(router,conterllersFile)

    app.use(router.routes())
}